// 导入请求请求

import axios from "./request.js"

export function fetchLunbo() {
    return axios.get('/getlunbo')
}
//http://api.w0824.com/api/recommend?page=3&limit=2

//购物车
export function fetchShoping(page = 1, limit = 10) {
    return axios.get(`/recommend?page=${page}&limit=${limit}`)
}

//购物车列表
export function fetchGoodsList(page = 1, limit = 6) {
    return axios.get(`/getgoods?pageindex=${page}&pagesize=${limit}`)
}

//新闻列表
export function fetchNews(page = 1, limit = 6) {
    return axios.get(`/getnewslist?page=${page}&pagesize=${limit}`)
}

//新闻详情
export function fetchNewsDetail(newid) {
    return axios.get(`/getnew/${newid}`)
}

//
export function fetchNewsComment(newid, page = 1) {
    return axios.get(`/getcomments/${newid}?pageindex=${page}`)
}

// review发布评论
export function fetchreview(newid, content) {
    return axios.post(`/postcomment/${newid}`, {
        content
    })
}


// 获取商品轮播图
export function fetchGoodsImgs(goodsid) {
    return axios.get(`/getthumbimages/${goodsid}`)
}

// 获取商品详情
export function fetchGoodsMessage(goodsid) {
    return axios.get(`/getgoodsinfo/${goodsid}`)
}

// 商品搜索接口
// search?value=i&sort=buy&page=1&pagesize=10
export function fetchSeekGoods(options) {
    let { value, sort, order, page, pagesize } = options;
    return axios.get(`/search?value=${value}&sort=${sort}&order=${order}&page=${page}&pagesize=${pagesize}`)
}

// 获取购物车商品列表
export function fetchCartGoods(ids) {
    return axios.get(`/getshopcarlist/${ids}`)
}

